package com.hcl.orm.core.executor;

import com.hcl.orm.core.executor.page.PageParam;

/**
 * @author hucl
 * @projectName jim-orm
 * @description: JDBC执行参数上下文
 * @date 2021/5/1818:14
 */
public class JdbcParam<T> {
    /**
     * JDBC 用户预定义SQL模板执行所需参数
     */
    private T jdbcArgs;
    /**
     * JDBC执行所需的分页参数
     */
    private Object[] jdbcPageArgs;
    /**
     * 用户预定义SQL模板
     */
    private String jdbcSqlTmpl;
    /**
     * 统计SQL语句模板
     */
    private String countSqlTmpl;
    /**
     * 是否分页查询
     */
    private boolean page;
    /**
     * 批量操作
     */
    private boolean batch;
    /**
     * 分页参数
     */
    private PageParam pageParam;


    public JdbcParam(String jdbcSqlTmpl, T jdbcArgs) {
        this.jdbcSqlTmpl = jdbcSqlTmpl;
        this.jdbcArgs = jdbcArgs;
        this.page = false;
    }

    public JdbcParam(String jdbcSqlTmpl, String countSqlTmpl, T jdbcArgs) {
        this.jdbcArgs = jdbcArgs;
        this.jdbcSqlTmpl = jdbcSqlTmpl;
        this.countSqlTmpl = countSqlTmpl;
        this.page = true;
    }

    public T getJdbcArgs() {
        return jdbcArgs;
    }


    public Object[] getJdbcPageArgs() {
        return jdbcPageArgs;
    }

    public void setJdbcPageArgs(Object[] jdbcPageArgs) {
        this.jdbcPageArgs = jdbcPageArgs;
    }

    public String getJdbcSqlTmpl() {
        return jdbcSqlTmpl;
    }

    public String getCountSqlTmpl() {
        return countSqlTmpl;
    }

    public void setCountSqlTmpl(String countSqlTmpl) {
        this.countSqlTmpl = countSqlTmpl;
    }

    public boolean isPage() {
        return page;
    }

    public void setPage(boolean page) {
        this.page = page;
    }

    public boolean isBatch() {
        return batch;
    }

    public void setBatch(boolean batch) {
        this.batch = batch;
    }

    public PageParam getPageParam() {
        return pageParam;
    }

    public void setPageParam(PageParam pageParam) {
        this.pageParam = pageParam;
    }
}
